﻿namespace Om.Camera.Dualix;

public class DualixCamera : IBaseCamera
{
    private bool _isConnected;
    public bool IsConnected
    {
        get => _isConnected;
        private set
        {
            if (_isConnected != value)
            {
                _isConnected = value;
                ConnectionChanged?.Invoke(this, value);
            }
        }
    }
    public event Action<byte[]>? FrameReceived;
    public event EventHandler<bool>? ConnectionChanged;
    public string Id { get; }
    public Task<List<string>> GetCameraList()
    {
        throw new NotImplementedException();
    }

    public async Task Connect(string cameraIpOrName = "")
    {
        SpectrolDllWrapper.DualixOpenCamera();

        float exposure = 0;
         SpectrolDllWrapper.DualixGetExposure(ref exposure);
        SpectrolDllWrapper.DualixSetExposure(110);
        SpectrolDllWrapper.DualixGetExposure(ref exposure);
    }

    public Task Disconnect()
    {
        throw new NotImplementedException();
    }

    public bool CanSetExposure => false;
    public Task Capture(string fileName)
    {
        throw new NotImplementedException();
    }
    public async Task<bool> SetAutoExposure(bool isAutoExposure)
    {
        return false;
    }

    public async Task<bool> SetExposureValue(int val)
    {
        return false;
    }

    public async Task<int> GetExposureValue()
    {
        return 0;
    }
}